#pragma once
#include "../sqlite3-secure/sqlite3.h"

#ifdef _DEBUG
#   pragma comment(lib, "sqlite3-secure_d.lib")
#else
#   pragma comment(lib, "sqlite3-secure.lib")
#endif
#include <iostream>
#include <vector>
using namespace std;


#define DESC	1
#define ASC		2

#define DB_INT	0x0010
#define DB_REAL	0x0011
#define DB_TEXT	0x0012
#define	DB_BLOB	0x0013


class CppSQLite3{
public:
	CppSQLite3();
	~CppSQLite3();
public:
	int		db_createdb(string db);
	int		db_connect(string db);
	int		db_disconnect();
	int		db_key(string key);
	int		db_resetkey(string key);

	void	db_data(vector<string> k, vector<string>  v);
	void	db_order(string o);
	void	db_desc(const int desc);
	void	db_table(string table);
	void	db_where(vector<string> k, vector<string>  v);
	void	db_field(vector<string> f);
	void	db_field();

	int		db_createtable(string t , vector<string> k, vector<int>  v);
	int		db_droptable(string t);
	int		db_add();
	int		db_delete();
	int		db_update();

	int		db_find();
	int		db_next();
	const unsigned char		*db_getcolunmtext(int c);
	void	db_finalize();

	const char * db_getlasterror();
private:
	string			db_path;
	string			db_passwd;
	sqlite3			*pDb;
	string			table;
	string			corder;
	string			cwhere;
	string			cfield;
	int				sort;
	vector<string>	vkeys;
	vector<string>	vvalues;
	sqlite3_stmt	*pStmt;
};